<%--
    Document   : home
    Created on : Oct 23, 2011, 5:06:42 PM
    Author     : Group 106
--%>
<%@page contentType="text/html" pageEncoding="UTF-8" errorPage="error.jsp"%>
<%@page import="java.util.ArrayList" %>
<%@page import="com.aptech.model.RealEstateType" %>
<%@page import="com.aptech.model.User" %>
<%@page import="com.aptech.model.RealEstateStyle" %>
<%@page import="com.aptech.model.postType" %>
<%@page import="com.aptech.DAO.realEstateTypeDAO" %>
<%@page import="com.aptech.DAO.realEstateStyleDAO" %>
<%@page import="com.aptech.DAO.postTypeDAO" %>

<%@taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <link rel="stylesheet" href="CSS/css.css" />
        <link rel="stylesheet" href="CSS/msh_style.css"/>
        <link rel="stylesheet" href="CSS/gallery_style.css"/>
       <!-- <link rel="stylesheet" href="CSS/css_header.css" /> -->
        <link rel="stylesheet" href="CSS/mn_left.css" />
        <link rel="stylesheet" href="CSS/mn_search.css" />
        <link rel="stylesheet" href="CSS/css_houseInfo.css" />
        <link rel="stylesheet" href="CSS/css_footer.css" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <%
                User objUser = null;
                String userID = "";
                String realEstateStyleID ;
                ArrayList<RealEstateType> listRealStateType = null;
                ArrayList<postType> listPostType = null;
                realEstateTypeDAO objrealEstateTypeDAO;
                postTypeDAO objPostTypeDAO;
                if (request.getSession().getAttribute("user") != null && request.getParameter("realEstateStyleID")!=null) {
                    objrealEstateTypeDAO = new realEstateTypeDAO();
                    objPostTypeDAO = new postTypeDAO();
                    objUser = (User) request.getSession().getAttribute("user");
                    userID = objUser.getUserID() + "";
                    listRealStateType = new ArrayList<RealEstateType>();
                    listRealStateType = objrealEstateTypeDAO.getAllRealEstateType();
                    listPostType = new ArrayList<postType>();
                    listPostType = objPostTypeDAO.getAllPostType();
                    realEstateStyleID = request.getParameter("realEstateStyleID");

    %>
    <body>

        <div id="wrap">
            <%@include file="header.jsp" %>
            
            <div class="clear"></div><!--End .clear-->
            <div id="main">
                <div id="left_sidebar">
                    <%@include file="leftSidebar.jsp" %>
                </div><!--End #left_sidebar-->
                <div id="content">
                    <table width="600" border="0" align="center">
                        <tr>
                            <td>
                                <html:form action="copyImage.do" method="post" enctype="multipart/form-data">
                                <table width="600" border="0" align="center" cellspacing="10">
                                    <html:hidden property="realEstateStyleID" value="<%=realEstateStyleID %>" />
                                    <tr>
                                        <td width="200">(*) Title  </td>
                                        <td><input type="text" name="realEstateTitle" size="35" /> </td>
                                    </tr>
                                    <tr>
                                        <td width="200">(*) City : </td>
                                        <td><input type="text" name="city" size="35" /></td>
                                    </tr>
                                    <tr>
                                        <td width="200">(*) Stress :</td>
                                        <td><input type="text" name="street"  size="40" /></td>
                                    </tr>
                                    <tr>
                                        <td width="200">(*) Price :</td>
                                        <td>
                                            <input type="text" name="price" size="20" /> 000 VND
                                        </td>
                                    </tr>
                                            <input type="hidden" name="realEstateTypeID" value="6"/>
                                    
                                    <tr>
                                        <td width="40%">(*) Deposit :</td>
                                        <td width="60%"><input type="text" name="deposit" size="20" />.000VND</td>
                                    </tr>
                                    <tr>
                                        <td>Descriptions : </td>
                                        <td><textarea name="description" cols="40" rows="5"></textarea></td>
                                    </tr>
                                    <tr>
                                        <td>(*) Image: </td>
                                        <td><html:file property="realEstateImage" /></td>
                                    </tr>
                                    <tr>
                                        <td>Posting Time:</td>
                                        <td>
                                            <select name="postTypeID">
                                                <% for(int j = 0; j< listPostType.size();j++){
                                                   postType objPostType = listPostType.get(j);
                                                %>
                                                <option value="<%=objPostType.getPostTypeID() %>"><%=objPostType.getPostTypeName()%></option>
                                                <% } %>
                                            </select>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right"><html:submit property="btnSubmit" value="        Post        " /></td>
                                        <td>
                                            <html:button property="btnSubmit" value="        Reset        " />
                                            <html:button property="btnSubmit" value="        Cancel        " />
                                        </td>
                                    </tr>
                                </table>
                                </html:form>
                            </td>
                        </tr>
                    </table>
                </div><!--End #content-->
            </div><!--End #main-->
            <div class="cleaner_with_height">&nbsp;</div><!--End .clear-->
            <div class="cleaner_with_height">&nbsp;</div><!--End .clear-->
            <div id="msh_footer_panel" style="width: 942px;">
    Copyright © 2011 <a href="aptech.vn">Ha Noi - Aptech</a> | <a href="home.jsp" target="_parent">Website My Sweet Home</a> by <a href="home.jsp" target="_blank">Group 106</a>
            </div>
        </div><!--End #wrap-->
        <div class="clear"></div><!--End .clear-->
    </body>
    <%
              } else {
                    response.sendRedirect("login.jsp");
                }
    %>
</html>